
<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>模拟京东搜索框</title>
  <style>
    /* 外层容器 */
   .search-container {
      width: 500px;
      margin: 50px auto;
      border: 1px solid #ccc;
      border-radius: 25px;
      overflow: hidden;
    }

    /* 输入框 */
   .search-input {
      width: 400px;
      height: 40px;
      border: none;
      padding: 0 15px;
      outline: none;
    }

    /* 搜索按钮 */
   .search-button {
      width: 80px;
      height: 40px;
      background-color: #f00;
      color: white;
      border: none;
      cursor: pointer;
    }
  </style>
</head>

<body>
  <div class="search-container">
    <input type="text" class="search-input" placeholder="请输入搜索内容">
    <button class="search-button">搜索</button>
  </div>
  <script>
    // 这里可以添加后续交互逻辑，比如点击按钮后的搜索行为
    const searchButton = document.querySelector('.search-button');
    const searchInput = document.querySelector('.search-input');
    searchButton.addEventListener('click', function () {
      const keyword = searchInput.value;
      if (keyword) {
        // 这里可以替换为实际的搜索跳转逻辑
        alert('你搜索的关键词是:'+ keyword);
      }
    });
  </script>
</body>

</html>